package app.Disthanitian.thaistyle.EmerMez;

import java.util.Random;

public class RandomPassword {

	private static final String charset = "!@#$%^&*()" +
    		"0123456789" +
    		"abcdefghijklmnopqrstuvwxyz" +
    		"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	public static String password ="";
     //int number =10; 
    public static String getRandomString() {
        Random rand = new Random(System.currentTimeMillis());
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i <= 7; i++ ) {
            int pos = rand.nextInt(charset.length());
            sb.append(charset.charAt(pos));
            password = sb.toString();
        }
        return  password;
    }
  
    public static void main(String[] args) {
        for (int i=0 ; i<7; i++){

            System.out.println(RandomPassword.getRandomString());

            try {
                // if you generate more than 1 time, you must
                // put the process to sleep for awhile
                // otherwise it will return the same random string
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
